﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="mfApplyDrawals.aspx.cs" Inherits="msBsc.WebUi.mMall.Buyer.mfApplyDrawals" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>手机地接客</title>
    <%=getMeta()%>
    <link rel="stylesheet" type="text/css" href="/themes/mStyle1/mGlobal.css" charset="gbk" />
    <%=getBodyBeforeJs()%>
    <!--start JS引用-->
    <script src="/jqPlugin/js/jquery-1.8.3.min.js"></script>
    <script src="/jqPlugin/js/jBase.js"></script>
    <script src="/jqPlugin/js/jBPage.js"></script>
    <script src="/jqPlugin/js/laytpl.js"></script>
    <script src="/themes/wStyle1/js/comm/VerifyJs.js"></script>
    <!--end JS引用-->
    <script type="text/javascript">
        $(window).load(function () {
            $("#h_title").text("申请提现");
            var oparm = new jsonRow();
            oparm.AddCell("ACTION", "InitInfo");
            ajaxComm(oparm);
        });
    </script>
    <!--head fix rgn-->
    <style>
        input[type=button] {
            width: 80px;
            height: 28px;
            text-align: center;
            line-height: 28px;
            border: 0;
            background-color: #7abd54;
            color: #fff;
            font-size: 14px;
            font-family: 微软雅黑;
            cursor: pointer;
        }

            input[type=button]:hover {
                opacity: 0.8;
            }

        .bind-notice-msg {
            width: 770px;
            padding: 10px 15px;
            border: 1px solid #f60;
            font-family: 微软雅黑;
            font-size: 16px;
            color: #0094ff;
            margin-bottom: 20px;
            text-indent: 32px;
        }

        .content-wrap {
            width: 100%;
            padding: 20px;
        }

            .content-wrap span {
                display: table-cell;
                padding-right: 15px;
            }

        .content-row {
            line-height: 45px;
        }

        .bindBank-title, .bindAlipay-title {
            /*width: 780px;*/
            height: 35px;
            line-height: 35px;
            font-family: 微软雅黑;
            font-size: 18px;
            color: #fff;
            background-color: #0094ff;
            padding-left: 20px;
        }

        .bindBank-content, .bindAlipay-content {
            /*width: 798px;*/
            border: 1px solid #808080;
        }

        .bindAlipayInfo {
            margin-top: 15px;
        }

        .notice-title {
            width: 120px;
            text-align: right;
            font-family: 微软雅黑;
            font-size: 14px;
            color: #808080;
            letter-spacing: 3px;
        }

        .lab-CCY {
            font-size: 20px;
            font-family: 微软雅黑;
            color: #f00 !important;
        }

        #labDrawals, #labPromBalance {
            font-size: 18px;
            font-family: 微软雅黑;
            color: #f60;
        }

        #txtApplyBalance {
            border: 0;
            border: 1px solid #808080;
            height: 25px;
            line-height: 25px;
            width: 200px;
        }

        .divAlipayInfo, .divBankInfo {
            margin-bottom: 20px;
        }

        .divBankInfo {
            display: none;
        }
    </style>
    <link href="/themes/mStyle1/css/public/mDjackPersonalBase.css" rel="stylesheet" />
    <link rel="stylesheet" href="/themes/mStyle1/mSearch.css" />
    <link href="/themes/mStyle1/css/home/base.css" rel="stylesheet" />
    <%--    <link rel="stylesheet" href="/themes/Style1/schList.css" />--%>
    <base target="_self" />
</head>
<body>
    <div class="viewport" style="background-color: #edeeee">
        <%=msBsc.WebUi.Code.QtHtmlGet.GetWapHeaderMenuHtml(true) %>
        <div class="content-wrap">
            <div class="bindBankInfo" style="margin-bottom: 10px;">
                <div class="bindBank-title">账户信息</div>
                <div class="bindBank-content">
                    <div class="content-row">
                        <span class="notice-title">账户类型:</span>
                        <span class="cust-input">
                            <input type="radio" name="radAccType" id="radAlipay" checked="checked" /><label for="radAlipay">支付宝账户</label>
                            <%--<input type="radio" name="radAccType" id="radBank" /><label for="radBank">银行账户</label>--%>
                        </span>
                    </div>

                    <div class="divAlipayInfo">
                        <div class="content-row">
                            <span class="notice-title">支付宝账号:</span>
                            <span class="cust-input">
                                <label id="labAliAccount"></label>
                            </span>
                        </div>
                    </div>

                   <%-- <div class="divBankInfo">
                        <div class="content-row">
                            <span class="notice-title">银行账号:</span>
                            <span class="cust-input">
                                <label id="labBankAccount"></label>
                            </span>
                        </div>
                        <div class="content-row">
                            <span class="notice-title">用户名:</span>
                            <span class="cust-input">
                                <label id="labBankAccNme"></label>
                            </span>
                        </div>
                        <div class="content-row">
                            <span class="notice-title">开户行:</span>
                            <span class="cust-input">
                                <label id="labBankSource"></label>
                            </span>
                        </div>
                        <div class="content-row">
                            <span class="notice-title">银行名称:</span>
                            <span class="cust-input">
                                <label id="labBankAddrNme"></label>
                            </span>
                        </div>
                    </div>--%>
                </div>
            </div>

            <div class="bindBankInfo">
                <div class="bindBank-title">申请提现</div>
                <div class="bindBank-content">
                    <div class="content-row">
                        <span class="notice-title">账户余额:</span>
                        <span class="cust-input">
                            <label class="lab-CCY">￥</label><label id="labDrawals"></label>
                        </span>
                    </div>
                    <div class="content-row">
                        <span class="notice-title">提现金额:</span>
                        <span class="cust-input">
                            <input type="text" id="txtApplyBalance" value="" placeholder="请输入提现金额" />
                        </span>
                    </div>
                    <div class="content-row">
                        <span class="notice-title"></span>
                        <span class="cust-input">
                            <input type="button" id="btnDrawals" value="提交申请" />
                        </span>
                    </div>
                </div>
            </div>
        </div>
        <%=msBsc.WebUi.Code.QtHtmlGet.GetWapMenuHtml() %>
    </div>


    <script type="text/javascript">
        var totalBalance = 0;
        $(function () {
            var currentVal = "";
            var nextVal = "";
            var KeyVal = "";
            $("#txtApplyBalance").focus().keydown(function () {
                currentVal = $(this).val();
            }).keyup(function () {
                nextVal = ComfirmBalance(currentVal);
                $(this).val(nextVal);
            })

            checkShowAccount();

            $("input[type=radio]").click(function () {
                checkShowAccount();
            });

            $("#btnDrawals").click(function () {
                SubmitApply();
            })
        })

        function ComfirmBalance(beforeVal) {
            var newVal = $("#txtApplyBalance").val();

            if (isNaN(newVal)) {
                alert("数字格式错误，请输入正确的数字");
                return beforeVal;
            }

            if (newVal - totalBalance > 0) {
                alert("输入的金额不能大于账户余额，请重新输入");
                return beforeVal;
            }
            return newVal;
        }

        function checkShowAccount() {
            var checkedId = $("input[type=radio]:checked").attr("id");
            debugger;
            if (checkedId == "radAlipay") {
                $(".divAlipayInfo").show();
                $(".divBankInfo").hide();
            }
            else if (checkedId == "radBank") {
                $(".divAlipayInfo").hide();
                $(".divBankInfo").show();
            }
        }

        function InitAccountInfo() {
            var oparm = new jsonRow();
            oparm.AddCell("ACTION", "InitAccount");
            ajaxComm(oparm);
        }

        function SetAccountInfo(_data) {
            if (IsNull(_data.rows[0].CUSTOMER_ALIPAY_ACCOUNT)) {
                $("#radBank").attr("checked", "checked");
                $(".divAlipayInfo").hide();
                $(".divBankInfo").show();
            }

            $("#labDrawals").text(IsNull(_data.rows[0].CUSTOMER_DRAWALS_ACCOUNT) ? "0.00" : _data.rows[0].CUSTOMER_DRAWALS_ACCOUNT);
            totalBalance = $("#labDrawals").text();
            $("#labAliAccount").text(IsNull(_data.rows[0].CUSTOMER_ALIPAY_ACCOUNT) ? "暂未绑定" : _data.rows[0].CUSTOMER_ALIPAY_ACCOUNT);
            $("#labBankAccount").text(IsNull(_data.rows[0].CUSTOMER_BANK_ACCOUNT) ? "暂未绑定" : _data.rows[0].CUSTOMER_BANK_ACCOUNT);
            $("#labBankSource").text(IsNull(_data.rows[0].BANK_NME) ? "暂未绑定" : _data.rows[0].BANK_NME);
            $("#labBankAccNme").text(IsNull(_data.rows[0].CUSTOMER_ACCOUNT_NAME) ? "暂未绑定" : _data.rows[0].CUSTOMER_ACCOUNT_NAME);
            $("#labBankAddrNme").text(IsNull(_data.rows[0].CUSTOMER_BANK_NAME) ? "暂未绑定" : _data.rows[0].CUSTOMER_BANK_NAME);
        }

        function SubmitApply() {
            if ($("#labDrawals").text() - 0 <= 0) {
                alert("账户无可提现金额");
                return;
            }

            var drawalsBalance = $.trim($("#txtApplyBalance").val());

            if (isNaN(drawalsBalance)) {
                alert("请输入正确的提现金额");
                return;
            }

            if (drawalsBalance - 0 <= 0) {
                alert("提现金额必须大于零");
                return;
            }

            if ($("#labDrawals").text() - drawalsBalance < 0) {
                alert("提现金额不得大于账户余额");
                return;
            }

            var oparm = new jsonRow();
            oparm.AddCell("ACTION", "SubmitApply");
            oparm.AddCell("Balance", drawalsBalance);
            oparm.AddCell("DrawalsType", $("input[type=radio]:checked").attr("id") == "radAlipay" ? "1" : "2");
            $("#txtApplyBalance").attr("disabled", "disabled");
            $("#btnDrawals").attr("disabled", "disabled");
            ajaxComm(oparm, null, function () {
                $("#txtApplyBalance").removeAttr("disabled");
                $("#btnDrawals").removeAttr("disabled");
            });
        }

        function ShowSuccessMsg(msg) {
            alert(msg);
            window.location.href = "/mb_ApplyDrawals.htm";
        }

        $(document).ready(function () {
            $.getMessageCount();
        });
    </script>
</body>
</html>
